ITEP-71829 Add is_background label#686
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a new is_background flag to the Label entity so that background labels can be identified and mapped correctly for semantic segmentation.
- Extends
Labelconstructor, docstring, and__repr__to includeis_background - Updates MongoDB mapper to forward and backward map the
is_backgroundfield - Adjusts existing static mapper test to cover
is_backgroundin forward mapping
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/repos/mappers/test_static_mappers.py | Added is_background=True to the Label in the mapper test |
| iai_core/repos/mappers/mongodb_mappers/label_mapper.py | Included is_background in forward and backward mappings |
| iai_core/entities/label.py | Added is_background parameter, storage, docstring entry, and updated __repr__ |
Comments suppressed due to low confidence (2)
interactive_ai/libs/iai_core_py/tests/repos/mappers/test_static_mappers.py:330
- Add a test case for backward mapping when
is_backgroundis omitted to ensure the default value ofFalseis correctly applied byLabelToMongo.backward.
is_background=True,
interactive_ai/libs/iai_core_py/iai_core/entities/label.py:102
- [nitpick] Consider updating any user-facing or generated API documentation (e.g., Sphinx/RST docs) to include the new
is_backgroundparameter under theLabelreference section.
:param is_background: boolean that indicates whether the label is the background label.
leoll2
approved these changes
Jul 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Adds a new parameter:
is_backgroundto the Label entity.An annotation with a label whose
is_backgroundvalue is True will be used to cut the mask for semantic segmentation task.✨ Type of Change
Select the type of change your PR introduces:
🧪 Testing Scenarios
Describe how the changes were tested and how reviewers can test them too:
✅ Checklist
Before submitting the PR, ensure the following: